import org..sparkimport
org.apache.spark.sql.SparkSession
object TestMap {  def main(args: Array[String]): Unit = {
  val spark = SparkSession.builder()
    .appName("RDDPartitionExample")
    .master("local[*]")
    .getOrCreate()
  val sc = spark.sparkContext
  val distData = sc.parallelize(List(1,3,45,3,76))
  val sq_dist = distData.map(x => x * x)
  val data = sc.parallelize(List((1,3),(45,3),(7,6)))
  val sort_data = data.sortBy(x => x._2,false,1)
  println(sq_dist.collect().mkString(" "))
  println(sort_data.collect().mkString(" "))  }}